local skel = fk.CreateSkill{
  name = "lb__wennie",
  tags = {Skill.Limited}
}

Fk:loadTranslationTable{
  ["lb__wennie"] = "问孽",
  [":lb__wennie"] = "<b>限定技</b>，每轮开始时，你可指定一名角色，当其于回合外使用基本牌/回合内使用锦囊牌时，其获得“承”/“负”（“承”/“负”各至多为1）。",

  ["#lb__wennie"] = "问孽：你可以令一名角色使用牌时获得“承”/“负”",
  ["@lb__wennie"] = "问孽",
  ["@@lb__wennie"] = "问孽",
  ["@@lb__wennie_cheng"] = "承",
  ["@@lb__wennie_fu"] = "负",

  ["$lb__wennie1"] = "十王垂庇，无往不胜。",
  ["$lb__wennie2"] = "罪业的气息很重啊…",
}

skel:addEffect(fk.RoundStart, {
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(skel.name) and player:usedSkillTimes(skel.name,Player.HistoryGame) == 0
  end,
  on_cost = function (self, event, target, player, data)
    local t = player.room:askToChoosePlayers(player,{
        targets = player.room:getAlivePlayers(),
        min_num = 1,
        max_num = 1,
        skill_name = skel.name,
        prompt = "#lb__wennie",
      })
    if #t > 0 then
      event:setCostData(self,{tos = t})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local t = event:getCostData(self).tos[1]
    room:setPlayerMark(t, "@@lb__wennie", 1)
    room:setPlayerMark(player, "@lb__wennie", t)
  end,
})

skel:addEffect(fk.CardUsing, {
  can_refresh = function(self, event, target, player, data)
    return target == player and player:getMark("@@lb__wennie") > 0
  end,
  on_refresh = function(self, event, target, player, data)
    if player.phase == Player.NotActive and data.card.type == Card.TypeBasic then
      player.room:setPlayerMark(player, "@@lb__wennie_cheng", 1)
    elseif player.phase ~= Player.NotActive and data.card.type == Card.TypeTrick then
      player.room:setPlayerMark(player, "@@lb__wennie_fu", 1)
    end
  end,
})

return skel